'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE ,UUID,TEXT,FLOAT} = app.Sequelize;
  var moment = require('moment');

  const fd_store = app.model.define('fd_store', {
    id: { type: UUID, primaryKey: true},
    center_id:{
      type:STRING(50)
    },//所属中心id
    name:STRING(10),//门店名称，
    phone: STRING(50),//联系电话
    realname: STRING(50),//负责人姓名
    province: STRING(50),//省市
    address: {type:STRING(200)},//街道具体地址
    deleted:{type:STRING(1),defaultValue:'0'} ,//0:可用 ,1:不可用
    created_at: {
      type: DATE,
      get() {
        return moment(this.getDataValue('created_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
    updated_at: {
      type: DATE,
      get() {
        return moment(this.getDataValue('updated_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    }
  },{freezeTableName: true,timestamps: true})

  return fd_store;
};
